package main

import "fmt"

type Point struct {
	X, Y int
}

type Circle struct {
	Point
	Radius int
}

type Wheel struct {
	Circle
	Spokes int
}

func main() {
	var w Wheel
	w.X = 8
	w.Y = 8
	w.Radius = 5
	w.Spokes = 20
	fmt.Printf("%#v\n", w)
	// 结构体字面值必须遵循形状类型声明时的结构，所以只能用下面两种语法，它们是等价的
	w = Wheel{Circle{Point{8, 9}, 5}, 20}
	w = Wheel{
		Circle: Circle{
			Point:  Point{X: 8, Y: 9},
			Radius: 5,
		},
		Spokes: 20, // 结尾逗号必须的
	}
	fmt.Printf("%#v\n", w) // 副词#表示用和Go语言类似的语法打印值。对于结构体类型来说，将包含每个成员的名字
	fmt.Printf("%v\n", w)
}
